// homepackage/pages/service-details/service-details.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    current: 0,
    hasPlay: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    console.log(options.id);
  },
  onReady() {
    this.videoContext = wx.createVideoContext('videos')
  },
  handleChange(event) {
    const current = event.detail.current
    this.videoContext.pause()
    this.setData({
      hasPlay: false
    })
  },
  handlePlay() {
    if (!this.data.hasPlay) {
      this.videoContext.play()
      this.setData({
        hasPlay: true
      })
    } else {
      this.videoContext.pause()
      this.setData({
        hasPlay: false
      })
    }
  }
})